home *** CD-ROM | disk | FTP | other *** search
- public class ItemUtilityTorch extends Codex {
- int flameGuid;
-
- public void CreateTorch() {
- CodexThing torch = new CodexThing(((Codex)this).GetClassThing());
- this.flameGuid = torch.SpawnThing("torchFlame_nosave");
- int boneNum = torch.FindBone(34);
- float[] offset = new float[3];
- offset = torch.FindBoneOffset(34);
- torch.AttachThing(this.flameGuid, boneNum, offset, 1);
- }
-
- public void beginscene(int clientGuid, int captureID) {
- CodexItem torch = new CodexItem(((Codex)this).GetClassThing());
- if ((torch.GetItemFlags() & 2097152) != 0) {
- this.CreateTorch();
- }
-
- }
-
- public void endscene(int clientGuid, int captureID, int exitNum) {
- this.DestroyTorch();
- }
-
- public boolean unworn(int guid, int wearerGuid, int captureId) {
- this.DestroyTorch();
- return true;
- }
-
- public void DestroyTorch() {
- if (this.flameGuid != 0) {
- CodexThing flame = new CodexThing(this.flameGuid);
- flame.Remove();
- this.flameGuid = 0;
- }
-
- }
-
- public void worn(int guid, int wearerGuid, int captureId) {
- this.CreateTorch();
- }
- }
-